using System;
using System.Collections.Generic;
using UnityEngine;

namespace LS.UnityExtensions
{
    public static partial class LSReflection
    {
        private static readonly Dictionary<string, Type> s_PrimitiveTypeSingleNameMap = new Dictionary<string, Type>()
        {
            ["object"] = typeof(object),
            ["bool"] = typeof(bool),
            ["byte"] = typeof(byte),
            ["sbyte"] = typeof(sbyte),
            ["string"] = typeof(string),
            ["char"] = typeof(char),
            ["short"] = typeof(short),
            ["int"] = typeof(int),
            ["long"] = typeof(long),
            ["ushort"] = typeof(ushort),
            ["uint"] = typeof(uint),
            ["ulong"] = typeof(ulong),
            ["float"] = typeof(float),
            ["double"] = typeof(double),
            ["decimal"] = typeof(decimal),
            ["byte[]"] = typeof(byte[]),
            ["object[]"] = typeof(object[]),
            ["bool[]"] = typeof(bool[]),
            ["sbyte[]"] = typeof(sbyte[]),
            ["string[]"] = typeof(string[]),
            ["char[]"] = typeof(char[]),
            ["short[]"] = typeof(short[]),
            ["int[]"] = typeof(int[]),
            ["long[]"] = typeof(long[]),
            ["ushort[]"] = typeof(ushort[]),
            ["uint[]"] = typeof(uint[]),
            ["ulong[]"] = typeof(ulong[]),
            ["float[]"] = typeof(float[]),
            ["double[]"] = typeof(double[]),
            ["decimal[]"] = typeof(decimal[]),
            ["List<object>"] = typeof(List<object>),
            ["List<bool>"] = typeof(List<bool>),
            ["List<byte>"] = typeof(List<byte>),
            ["List<sbyte>"] = typeof(List<sbyte>),
            ["List<string>"] = typeof(List<string>),
            ["List<char>"] = typeof(List<char>),
            ["List<short>"] = typeof(List<short>),
            ["List<int>"] = typeof(List<int>),
            ["List<long>"] = typeof(List<long>),
            ["List<ushort>"] = typeof(List<ushort>),
            ["List<uint>"] = typeof(List<uint>),
            ["List<ulong>"] = typeof(List<ulong>),
            ["List<float>"] = typeof(List<float>),
            ["List<double>"] = typeof(List<double>),
            ["List<decimal>"] = typeof(List<decimal>),
        };
        
        private static readonly Dictionary<string, Type> s_UnityTypeSingleNameMap = new Dictionary<string, Type>()
        {
            ["Vector2"] = typeof(Vector2),
            ["Vector3"] = typeof(Vector3),
            ["Vector4"] = typeof(Vector4),
            ["Vector2Int"] = typeof(Vector2Int),
            ["Vector3Int"] = typeof(Vector3Int),
            ["Quaternion"] = typeof(Quaternion),
            ["Color"] = typeof(Color),
            ["Color32"] = typeof(Color32),
            ["Rect"] = typeof(Rect),
            ["RectInt"] = typeof(RectInt),
            ["Bounds"] = typeof(Bounds),
            ["BoundsInt"] = typeof(BoundsInt),
            ["Vector2[]"] = typeof(Vector2[]),
            ["Vector3[]"] = typeof(Vector3[]),
            ["Vector4[]"] = typeof(Vector4[]),
            ["Vector2Int[]"] = typeof(Vector2Int[]),
            ["Vector3Int[]"] = typeof(Vector3Int[]),
            ["Quaternion[]"] = typeof(Quaternion[]),
            ["Color[]"] = typeof(Color[]),
            ["Color32[]"] = typeof(Color32[]),
            ["Rect[]"] = typeof(Rect[]),
            ["RectInt[]"] = typeof(RectInt[]),
            ["Bounds[]"] = typeof(Bounds[]),
            ["BoundsInt[]"] = typeof(BoundsInt[]),
            ["List<Vector2>"] = typeof(List<Vector2>),
            ["List<Vector3>"] = typeof(List<Vector3>),
            ["List<Vector4>"] = typeof(List<Vector4>),
            ["List<Vector2Int>"] = typeof(List<Vector2Int>),
            ["List<Vector3Int>"] = typeof(List<Vector3Int>),
            ["List<Quaternion>"] = typeof(List<Quaternion>),
            ["List<Color>"] = typeof(List<Color>),
            ["List<Color32>"] = typeof(List<Color32>),
            ["List<Rect>"] = typeof(List<Rect>),
            ["List<RectInt>"] = typeof(List<RectInt>),
            ["List<Bounds>"] = typeof(List<Bounds>),
            ["List<BoundsInt>"] = typeof(List<BoundsInt>),
        };
        
        private static readonly Dictionary<string, string> s_PrimitiveFullToSingleNameMap = new Dictionary<string, string>()
        {
            [typeof(object).FullName]= "object",
            [typeof(bool).FullName]= "bool",
            [typeof(byte).FullName]= "byte",
            [typeof(sbyte).FullName]= "sbyte",
            [typeof(string).FullName]= "string",
            [typeof(char).FullName]= "char",
            [typeof(short).FullName]= "short",
            [typeof(int).FullName]= "int",
            [typeof(long).FullName]= "long",
            [typeof(ushort).FullName]= "ushort",
            [typeof(uint).FullName]= "uint",
            [typeof(ulong).FullName]= "ulong",
            [typeof(float).FullName]= "float",
            [typeof(double).FullName]= "double",
            [typeof(decimal).FullName]= "decimal",
        };
        
        private static readonly Dictionary<string, string> s_UnityFullToSingleNameMap = new Dictionary<string, string>()
        {
            [typeof(Vector2).FullName] = "Vector2",
            [typeof(Vector3).FullName] = "Vector3",
            [typeof(Vector4).FullName] = "Vector4",
            [typeof(Vector2Int).FullName] = "Vector2Int",
            [typeof(Vector3Int).FullName] = "Vector3Int",
            [typeof(Quaternion).FullName] = "Quaternion",
            [typeof(Color).FullName] = "Color",
            [typeof(Color32).FullName] = "Color32",
            [typeof(Rect).FullName] = "Rect",
            [typeof(RectInt).FullName] = "RectInt",
            [typeof(Bounds).FullName] = "Bounds",
            [typeof(BoundsInt).FullName] = "BoundsInt",
        };
        
        private static readonly Dictionary<string, string> s_PrimitiveAssemblyQualifiedToSingleNameMap = new Dictionary<string, string>()
        {
            [typeof(object).AssemblyQualifiedName]= "object",
            [typeof(bool).AssemblyQualifiedName]= "bool",
            [typeof(byte).AssemblyQualifiedName]= "byte",
            [typeof(sbyte).AssemblyQualifiedName]= "sbyte",
            [typeof(string).AssemblyQualifiedName]= "string",
            [typeof(char).AssemblyQualifiedName]= "char",
            [typeof(short).AssemblyQualifiedName]= "short",
            [typeof(int).AssemblyQualifiedName]= "int",
            [typeof(long).AssemblyQualifiedName]= "long",
            [typeof(ushort).AssemblyQualifiedName]= "ushort",
            [typeof(uint).AssemblyQualifiedName]= "uint",
            [typeof(ulong).AssemblyQualifiedName]= "ulong",
            [typeof(float).AssemblyQualifiedName]= "float",
            [typeof(double).AssemblyQualifiedName]= "double",
            [typeof(decimal).AssemblyQualifiedName]= "decimal",
        };
        
        private static readonly Dictionary<string, string> s_UnityAssemblyQualifiedToSingleNameMap = new Dictionary<string, string>()
        {
            [typeof(Vector2).AssemblyQualifiedName] = "Vector2",
            [typeof(Vector3).AssemblyQualifiedName] = "Vector3",
            [typeof(Vector4).AssemblyQualifiedName] = "Vector4",
            [typeof(Vector2Int).AssemblyQualifiedName] = "Vector2Int",
            [typeof(Vector3Int).AssemblyQualifiedName] = "Vector3Int",
            [typeof(Quaternion).AssemblyQualifiedName] = "Quaternion",
            [typeof(Color).AssemblyQualifiedName] = "Color",
            [typeof(Color32).AssemblyQualifiedName] = "Color32",
            [typeof(Rect).AssemblyQualifiedName] = "Rect",
            [typeof(RectInt).AssemblyQualifiedName] = "RectInt",
            [typeof(Bounds).AssemblyQualifiedName] = "Bounds",
            [typeof(BoundsInt).AssemblyQualifiedName] = "BoundsInt",
        };

        private static readonly Dictionary<Type, string> s_PrimitiveSingleNameTypeMap = new Dictionary<Type, string>()
        {
            [typeof(object)] = "object",
            [typeof(bool)] = "bool",
            [typeof(byte)] = "byte",
            [typeof(sbyte)] = "sbyte",
            [typeof(string)] = "string",
            [typeof(char)] = "char",
            [typeof(short)] = "short",
            [typeof(int)] = "int",
            [typeof(long)] = "long",
            [typeof(ushort)] = "ushort",
            [typeof(uint)] = "uint",
            [typeof(ulong)] = "ulong",
            [typeof(float)] = "float",
            [typeof(double)] = "double",
            [typeof(decimal)] = "decimal"
        };
        
        private static readonly Dictionary<Type, string> s_UnitySingleNameTypeMap = new Dictionary<Type, string>()
        {
            [typeof(Vector2)] = "Vector2",
            [typeof(Vector3)] = "Vector3",
            [typeof(Vector4)] = "Vector4",
            [typeof(Vector2Int)] = "Vector2Int",
            [typeof(Vector3Int)] = "Vector3Int",
            [typeof(Quaternion)] = "Quaternion",
            [typeof(Color)] = "Color",
            [typeof(Color32)] = "Color32",
            [typeof(Rect)] = "Rect",
            [typeof(RectInt)] = "RectInt",
            [typeof(Bounds)] = "Bounds",
            [typeof(BoundsInt)] = "BoundsInt",
        };
    }
}